package com.sz.app.edi.service.receive.file;

import com.sz.common.base.logger.Logger;

import com.sz.biz.logistics.ord.service.OrdOrderService;
import org.apache.camel.Exchange;
import org.apache.camel.Processor;
import org.apache.camel.component.file.GenericFileMessage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;

import java.io.File;
import java.io.RandomAccessFile;

//@Component
public class LocationFileProcessor implements Processor {

    private final Logger logger = Logger.getLogger(this.getClass());

    @Value("${ftp.local.dir}")
    private String fileDir;

    @Autowired
    OrdOrderService orderService;//业务逻辑处理组件
    
    @Override
    public void process(Exchange exchange) throws Exception {
        GenericFileMessage<RandomAccessFile> inFileMessage = (GenericFileMessage<RandomAccessFile>) exchange.getIn();
        String fileName = inFileMessage.getGenericFile().getFileName();//文件名
        String splitTag = File.separator;//系统文件分隔符
        logger.info(fileDir + splitTag + fileName);//文件的绝对路径
       // orderService.saveOrderDto(new CusOrderDto());//解析入库等操作
        
    }

}